package com.rabbitmq.rabbitmqdemo.controller;

import com.rabbitmq.rabbitmqdemo.model.MyModel;
import com.rabbitmq.rabbitmqdemo.producer.MyProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

/**
 * @Author: zhangQi
 * @Date: 2020-07-19 10:41
 */
@RestController
public class MyMQController {
    @Autowired
    MyProducer myProducer;

    @GetMapping("/mq/producer")
    public String myProducer(String content){
        MyModel model = new MyModel();
        model.setId(UUID.randomUUID());
        model.setInfo(content);
        myProducer.sendMsg(model);
        return "已发送消息: "+content;
    }
}
